/**
 * Copyright (c) 2023 - present All rights reserved.
 * <p>
 * Reprinted has been protected by the copyright laws.
 */

package cn.myxl.smart.devkit.commit.submission;

import cn.myxl.smart.devkit.commit.model.SettingState;
import cn.myxl.smart.devkit.core.util.I18nUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;

/**
 * @author zhangyang
 * @date 2023-11-14 16:07
 */

public class CommitDialog extends DialogWrapper {
	private final CommitDialogUI commitDialogUI;

	public CommitDialog(@Nullable Project project, SettingState settingState) {
		super(project);
		commitDialogUI = new CommitDialogUI(project, settingState);
		setTitle(I18nUtil.get("commit.submission.title"));
		setOKButtonText(I18nUtil.get("commit.submission.ok"));
		setCancelButtonText(I18nUtil.get("commit.submission.cancel"));
		init();
	}

	@Nullable
	@Override
	protected JComponent createCenterPanel() {
		return commitDialogUI.getMainPanel();
	}

	public CommitMessage getCommitMessage(SettingState settings) {
		return commitDialogUI.getCommitMessage(settings);
	}
}
